package com.duapk.search.work;

import java.io.IOException;

import org.apache.lucene.index.IndexReader;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.function.CustomScoreProvider;
import org.apache.lucene.search.function.CustomScoreQuery;

import com.duapk.search.bean.IndexBrief;

/**
 * 自定义查询，时间加权
 * 
 * @ClassName: TimeCustomScoreQuery
 * @authro: jiangzheng
 * @date: Nov 24, 2010 4:17:29 PM
 * 
 */
@SuppressWarnings("serial")
public class ApkCustomScoreQuery extends CustomScoreQuery {

	/**
	 * 评分集合
	 */
	private IndexBrief brief;

	/**
	 * 评分的权重
	 */
	private float starWeight;

	public ApkCustomScoreQuery(Query subQuery, IndexBrief brief,
			float starWeight) {
		super(subQuery);
		this.starWeight = starWeight;
		this.brief = brief;
	}

	@Override
	protected CustomScoreProvider getCustomScoreProvider(IndexReader reader)
			throws IOException {
		return new ApkCustomScoreProvider(reader, brief, starWeight);
	}

}
